#ifndef DATAFLOW_DETAIL_TASKINSTANCE_H
#define DATAFLOW_DETAIL_TASKINSTANCE_H

#include "Task.h"
#include "ArgumentArray.h"
#include "TaskInstancePtrList.h"

namespace DataFlow
{

namespace Detail
{

class Node;

class TaskInstance
{
	public:

		Task *              task;
		int                 taskId;
		Node *              node;
		ArgumentArray       input;
		ArgumentArray       output;
		TaskInstancePtrListIterator runningListIterator;

		TaskInstance(void)
			: task(0)
			, taskId(0)
			, node(0)
		{
			;
		}

		TaskInstance(Task * tTask, int tTaskId, Node * tNode, int tInputId, int tInputSize, int tOutputSize, TaskInstancePtrListIterator it)
			: task(tTask)
			, taskId(tTaskId)
			, node(tNode)
			, input(tInputId, tInputSize)
			, output(tInputId, tOutputSize)
			, runningListIterator(it)
		{
			;
		}

		void run(void)
		{
			if (this->task)
			{
				this->task->run(this->input, this->output);
			}
		}
};

}

}

#endif // DATAFLOW_DETAIL_TASKINSTANCE_H
